export default {
    buyProducts(products, onSuccess, onErr) {
        setTimeout(() => {
            if (Math.random() > 0.5) {
                onSuccess();
            } else {
                onErr();
            }
        }, 3000);
    },
    getData() {
        return new Promise((resolve, reject) => {
            setTimeout(() => {
                if (Math.random() > 0.5) {
                    resolve("Data");
                } else {
                    reject(new Error("码品不好"));
                }
            }, 3000);
        });
    },
    getOtherData() {
        return new Promise((resolve, reject) => {
            setTimeout(() => {
                if (Math.random() > 0.5) {
                    resolve("OtherData");
                } else {
                    reject(new Error("人品不好"));
                }
            }, 3000);
        });
    },
};
